]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
screenShield: Fix pointer showing on motion
authorCarlos Garnacho <carlosg@gnome.org>
Sun, 29 Jun 2025 09:35:24 +0000 (11:35 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Sun, 29 Jun 2025 14:26:59 +0000 (16:26 +0200)
As an additional side effect of switching to the cursor visibility
inhibition API in the cursor tracker, there is no longer this
infighting in Mutter where pointer motion tries to set pointer
visibility on (since it's the last device used), and other places
wanting to inhibit it, such as the screenshield.

This resulted on the cursor wanting to show by itself, and somehow
trigger captured motion events on the ClutterStage. This no longer
happens, which results in the pointer staying hidden, seat unfocus
remaining uninhibited, and no motion events being sent in (since
the pointer device now does remain unfocused).

Fix this by:
- Setting a seat unfocus inhibition, so the pointer triggers motion
  and focus despite being hidden
- Connecting to captured events on the screen lock group widget,
  since captured events will respect the existing grab

This results in pointer motion again resulting on the cursor being
shown, when waking up the lockscreen.

Fixes: 91c6366e0 ("Adjust to cursor tracker visibility API changes")
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3781>

js/ui/screenShield.js

index 0ee1ce284b433c2288d93d5c281798c688bc4e4a..2087c393edd448e32f72dae2b4a44837eed9adab 100644 (file)
@@ -370,25 +370,30 @@ export class ScreenShield extends Signals.EventEmitter {
 
     _showPointer() {
         if (this._cursorVisibleInhibited) {
+            const seat = global.stage.context.get_backend().get_default_seat();
             this._cursorTracker.uninhibit_cursor_visibility();
+            seat.uninhibit_unfocus();
             this._cursorVisibleInhibited = false;
         }
 
         if (this._motionId) {
-            global.stage.disconnect(this._motionId);
+            this._lockDialogGroup.disconnect(this._motionId);
             this._motionId = 0;
         }
     }
 
     _hidePointer() {
         if (!this._cursorVisibleInhibited) {
+            const seat = global.stage.context.get_backend().get_default_seat();
+            seat.inhibit_unfocus();
             this._cursorTracker.inhibit_cursor_visibility();
             this._cursorVisibleInhibited = true;
         }
     }
 
     _hidePointerUntilMotion() {
-        this._motionId = global.stage.connect('captured-event', (stage, event) => {
+        const eventActor = this._lockDialogGroup;
+        this._motionId = eventActor.connect('captured-event', (_, event) => {
             if (event.type() === Clutter.EventType.MOTION)
                 this._showPointer();